" vim:ft=vim

Execute(Include base):
  source test/base_vader.vim

Execute(test-FloatermKill):
  Log '# FloatermKill'
    FloatermNew
    Assert IsInFloatermBuffer()
    FloatermKill
    AssertEqual '', &filetype

  Log '# FloatermKill!'
    FloatermNew
    let bufnr1 = bufnr('%')
    FloatermNew
    let bufnr2 = bufnr('%')

    FloatermKill!
    AssertEqual 0, IsBufValid(bufnr1)
    AssertEqual 0, IsBufValid(bufnr2)

  Log '# [N]FloatermKill'
    FloatermNew
    let bufnr1 = bufnr('%')
    FloatermNew
    let bufnr2 = bufnr('%')

    FloatermHide " otherwise vim8 testing fails
    execute bufnr1 . 'FloatermKill'
    AssertEqual 0, IsBufValid(bufnr1)
    AssertEqual 1, IsBufValid(bufnr2)
    execute bufnr2 . 'FloatermKill'
    AssertEqual 0, IsBufValid(bufnr1)
    AssertEqual 0, IsBufValid(bufnr2)

  Log '# FloatermKill --name'
    FloatermNew --name=ft1
    let bufnr1 = bufnr('%')
    FloatermNew --name=ft2
    let bufnr2 = bufnr('%')

    FloatermKill ft1
    AssertEqual 0, IsBufValid(bufnr1)
    AssertEqual 1, IsBufValid(bufnr2)
    FloatermKill ft2
    AssertEqual 0, IsBufValid(bufnr1)
    AssertEqual 0, IsBufValid(bufnr2)

  FloatermKill!
  stopinsert
